/*
 * @Author: szx
 * @Date: 2022-03-28 13:07:53
 * @LastEditTime: 2022-03-28 13:26:30
 * @Description:
 * @FilePath: \leetcode\剑指offer\56\56.js
 */
/**
 * @param {number[]} nums
 * @return {number[]}
 */
var singleNumbers = function (nums) {
    let res = 0;
    for (let i of nums) res ^= i;
    let div = 1;
    while ((div & res) == 0) div << 1;
    let a = 0;
    b = 0;
    for (let i of nums) {
        if (div & i) {
            a ^= i;
        } else {
            b ^= i;
        }
    }
    return [a, b];
};
console.log(singleNumbers([4, 1, 4, 6]));
